<template>
  <div>
    <pf-table
      ref="pfTable"
      v-model="form"
      class="product-table"
      :columns="columns"
      :form-items="formItems"
      @get-table-data="getTableData"
    />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'TicketList',
  components: {
  },
  props: {
    type: { // 产品类型
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      loading: false,
      form: {},
      productList: []
    }
  },
  computed: {
    ...mapGetters([
      'currentEnterprise',
      'currentSite'
    ]),
    formItems() {
      return [
        {
          type: 'select',
          label: '套票栏目',
          prop: 'goodsName'
        },
        {
          type: 'input',
          label: '套票名称',
          prop: 'goodsName'
        },
        {
          type: 'date',
          label: '创建时间',
          prop: 'creatDateRange',
          span: 8,
          attrs: {
            type: 'daterange'
          }
        },
        {
          type: 'date',
          label: '有效期',
          prop: 'dateRange',
          span: 8,
          attrs: {
            type: 'daterange'
          }
        }
      ]
    },
    columns() {
      const attrs = { 'min-width': '150px' }
      return [
        { attrs: { type: 'selection' }},
        { label: '产品名称', prop: 'couponName', attrs },
        { label: '产品图片', prop: 'couponName', attrs },
        { label: '价格', prop: 'couponName', attrs },
        { label: '所属门店', prop: 'couponName', attrs }
      ]
    }
  },

  created() {
  },
  methods: {

    getTableData({ pageNo, pageSize, ...formQuery }, done) {
      this.loading = true
      const data = {
        pageNo,
        pageSize,
        ...formQuery
      }
      done({ data: [], total: 0 })
      // getProductList(data).then(res => {
      //   this.loading = false
      //   this.productList = res.data || []
      //   done({ total: res.count || 0 })
      // }).catch(() => {
      //   done({ data: [], total: 0 })
      //   this.loading = false
      // })
    },

    // 更新
    updateHandle() {
      this.$refs.pfTable.getTableData()
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
